<ui:composition template="/WEB-INF/templates/login-template.xhtml"
	xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:p="http://primefaces.org/ui">

	<ui:define name="menu"></ui:define>
	<ui:define name="submenu"></ui:define>
	<ui:define name="sidebar">
		<ui:include src="/WEB-INF/templates/public-sidebar.xhtml" />
	</ui:define>
	<ui:define name="content">		
	
	<h:form id="RRF" enctype="multipart/form-data" prependId="false"> 
	<p:growl />
	     <h:outputText value="Profiles from ERPandERP CV Database" styleClass="outputTextTitle"/>	
	     
	  <h:panelGrid >
		
        <p:panel header="Already Processed Profiles(Profiles ERP Database)"> 
		   <h:panelGrid style="width: 80%" id="rrfsPanel">
			 <p:scrollPanel style="width:830px;height:190px" mode="native"> 
			 <h:outputLabel value="Select Profiles based on Status : " style="font-weight:bold;"/>
			 <p:selectOneMenu value="#{uploadResourcesBean.profileStatus}" style="width:150px;">
			    <p:ajax event="change" listener="#{uploadResourcesBean.changeProfileListListener}" update="@form" />
           		
           		<f:selectItem itemLabel="All" itemValue="All" />
				<f:selectItem itemLabel="Open" itemValue="Open" />
				<f:selectItem itemLabel="Inprocess" itemValue="Inprocess" />
				<f:selectItem itemLabel="Rejected" itemValue="Rejected" />	
				<f:selectItem itemLabel="Selected" itemValue="Selected" />							
		     </p:selectOneMenu>    
             
             <p:dataTable value="#{uploadResourcesBean.cvDBProfilies}" var="profile">					
					
					<p:column headerText="Refer By/Source ">
						<h:outputText value="#{profile.recruitmentVendor.vendorName}" />
					</p:column>
					
					<p:column headerText="View Profile">
						<p:commandLink  value="View Profile" actionListener="#{uploadResourcesBean.fileDownload}" 
									ajax="false" update="@form" styleClass="downloadResumeCommandLink" style="color:blue;" title="Click to Download Resume">
									  <f:param name="candidateEmail" value="#{profile.candidateEmail}" />
									  <p:fileDownload value="#{uploadResourcesBean.file1}"></p:fileDownload>
						</p:commandLink>
					</p:column>
					
					<p:column headerText="Candidate Email">
						<h:outputText value="#{profile.candidateEmail}" />
					</p:column>
					<p:column headerText="Contact No">
						<h:outputText value="#{profile.candidateMobileNumber}" />
					</p:column>
					<p:column headerText="Location">
						<h:outputText value="#{profile.candidateCurrentLocation}" />
					</p:column>
					<p:column headerText="Upload Date">
						<h:outputText value="#{profile.createDate}" >
							<f:convertDateTime  pattern="dd-MMM-yyyy" timeZone="#{uploadResourcesBean.timeZone}"/>
						</h:outputText>
					</p:column>
					<p:column headerText="Experience">
						<h:outputText value="#{profile.candidateExperience}" />
					</p:column>
					<p:column headerText="Current Status">
						<h:outputText value="#{profile.profileCurrentStatus}" />
					</p:column>
					<p:column headerText="Remarks">
						<h:outputText value="#{profile.remarks}" />
					</p:column>
					<p:column headerText="View FeedBack" >
						 <p:commandButton value="View" update="@form" oncomplete="viewFeedbackDialog.show()" process="@this" actionListener="#{uploadResourcesBean.viewFeedbackAction}">
							 <f:param name="candidateEmail" value="#{profile.candidateEmail}" />
							 <f:param name="rrfCode" value="#{profile.recruitmentRequestCode}" />
						 </p:commandButton>
					</p:column> 
					
					<p:column headerText="Add Profile">
						<p:commandButton value="Add"  actionListener="#{uploadResourcesBean.addAlreadyProcessedProfilesAction}" ajax="false">
							<f:param name="profileId" value="#{profile.recruitmentProfileId}" />
						</p:commandButton>
					</p:column>
	         </p:dataTable>
	       </p:scrollPanel>
	      </h:panelGrid>
	    </p:panel>
	    
        <p:panel header="Upload New Resource(s)"> 
          
		   <h:panelGrid columns="8" style="border:0;" >
		   
			  
	           
	           <h:outputLabel value="*" style="color : red;" />
	           <h:outputLabel value="Candidate Name" />
	           <h:outputLabel value=" : " />
	           <p:inputText value="#{uploadResourcesBean.recruitmentProfile.candidateName}" />
	           
	           <h:outputLabel value="*" style="color : red;" />
	           <h:outputLabel value="Candidate Contact(+91)" />
	           <h:outputLabel value=" : " />
	            <p:inputMask value="#{uploadResourcesBean.recruitmentProfile.candidateMobileNumber}" mask="(999) 999-9999"/>
	           
	           <h:outputLabel value="*" style="color : red;"/>
	           <h:outputLabel value="Candidate Email" />
	           <h:outputLabel value=" : " />
	           <p:inputText value="#{uploadResourcesBean.recruitmentProfile.candidateEmail}" />
	           
	           <h:outputLabel value="*" style="color : red;"/>
	           <h:outputLabel value="Candidate Location" />
	           <h:outputLabel value=" : " />
	           <p:inputText value="#{uploadResourcesBean.recruitmentProfile.candidateCurrentLocation}" />
	           
	           <h:outputLabel value="*" style="color : red;"/>
	           <h:outputLabel value="Total Experience" />
	           <h:outputLabel value=" : " />
	           <p:inputText value="#{uploadResourcesBean.recruitmentProfile.candidateExperience}" maxlength="2"/>
	           
	           <h:outputLabel value="*" style="color : red;"/>
	           <h:outputLabel value="Notice Period (Days)" />
	           <h:outputLabel value=" : " />
	           <p:inputText id="NoticePeriod" value="#{uploadResourcesBean.recruitmentProfile.candidateNoticePeriod}" maxlength="3"/>
	           
	           <h:outputLabel value="*" style="color : red;"/>
	           <h:outputLabel value="CTC(INR)" />
	           <h:outputLabel value=" : " />
	           <p:inputText id="CTCINR" value="#{uploadResourcesBean.recruitmentProfile.ctc}" maxlength="7"/>
	           
	           <h:outputLabel value="*" style="color : red;"/>
	           <h:outputLabel value="ECTC (INR)" />
	           <h:outputLabel value=" : " />
	           <p:inputText id="ECTCINR" value="#{uploadResourcesBean.recruitmentProfile.ectc}" maxlength="7"/>
	           
	           
	           
	           <h:outputLabel value="*" style="color : red;"/>
	           <h:outputLabel value="Notice Period Buyout" />
	           <h:outputLabel value=" : " />
	           <p:selectOneMenu value="#{uploadResourcesBean.recruitmentProfile.noticePeriodBuyOut}" style="width:160px;">
							<f:selectItems value="#{uploadResourcesBean.noticePeriodBuyOutMap}" />
							<p:ajax event="change" listener="#{uploadResourcesBean.enableOrDisableBuyoutCostListener}" update="buyoutCost"/>
			   </p:selectOneMenu> 
			   
			   <h:outputLabel value="*" style="color : red;"/>
	           <h:outputLabel value="Source" />
	           <h:outputLabel value=" : " />
	           <p:selectOneMenu value="#{uploadResourcesBean.recruitmentVendorId}" style="width:160px;">
					<f:selectItems value="#{uploadResourcesBean.recruitmentVendorsMap}" />
			   </p:selectOneMenu>
	           
	           <h:outputLabel value="" style="color : red;"/>
	           <h:outputLabel value="Buyout Cost(INR)" />
	           <h:outputLabel value=" : " />
	           <p:inputText id="buyoutCost" value="#{uploadResourcesBean.recruitmentProfile.noticePeriodBuyOutCost}" maxlength="7" disabled="#{uploadResourcesBean.disableBuyoutCost}"/>
	           
	           <h:outputLabel value="*" style="color : red;"/>
	           <h:outputLabel value="Expected Joining Date" />
	           <h:outputLabel value=" : " />
	           <p:calendar id="ExpectedJoiningDate" value="#{uploadResourcesBean.recruitmentProfile.expectedJoiningDate}" pattern="dd-MMM-yyyy"/>
	           
	             
			   
			   <h:outputLabel value="*" style="color : red;" />
	           <h:outputLabel value="Upload Resume" />
	           <h:outputLabel value=" : " />
	           <p:fileUpload value="#{uploadResourcesBean.file}" mode="simple" /> 
	           
	           <h:outputLabel value="" style="color : red;"/>
	           <h:outputLabel value="Remarks" />
	           <h:outputLabel value=" : " />
	           <p:inputTextarea value="#{uploadResourcesBean.recruitmentProfile.remarks}" autoResize="false" cols="17" rows="2" />
				
				<h:inputHidden /><p:commandButton value="Add" title="Add New Resource" action="#{uploadResourcesBean.createAnotherResourceAction}"  ajax="false" />
				
		   </h:panelGrid>
 	    </p:panel>
	   
 	    <p:panel header="Newly Added Resource Details">
 		  <h:panelGrid>	
 		     <p:scrollPanel style="width:830px;height:300px" mode="native">   
				<p:dataTable value = "#{uploadResourcesBean.recruitmentProfiles}" var = "row" binding="#{uploadResourcesBean.assignedNewResourcesTable}">  
									
					<!-- <p:column  headerText="Resume" >
					  <p:cellEditor>  						
						<f:facet name="output">  
		                    <h:outputText value="#{row.uploadFilePath}" />
		                </f:facet>  
		                <f:facet name="input">  
		                    <h:outputText value="#{row.uploadFilePath}" style="width:100%"/>  
		                </f:facet>  
					  </p:cellEditor>
					</p:column>  -->
										
					<p:column headerText="Candidate Name">
						<p:cellEditor>
							<f:facet name="output">  
			                    <h:outputText  value="#{row.candidateName}"/>
			                </f:facet>  
			                <f:facet name="input">  
			                    <p:inputText  value="#{row.candidateName}" style="width:100px"/>  
			                </f:facet>  							
						</p:cellEditor>
					</p:column>
					
					<p:column headerText="Candidate Contact">
						<p:cellEditor>							
							<f:facet name="output">  
			                    <h:outputText value="#{row.candidateMobileNumber}" />
			                </f:facet>  
			                <f:facet name="input">  
			                    <p:inputText  value="#{row.candidateMobileNumber}" style="width:100px"/>  
			                </f:facet> 
						</p:cellEditor>
					</p:column>
					
					<p:column headerText="Candidate Email">
						<p:cellEditor>							
							<f:facet name="output">  
			                    <h:outputText value="#{row.candidateEmail}" />
			                </f:facet>  
			                <f:facet name="input">  
			                    <p:inputText  value="#{row.candidateEmail}" style="width:150px"/>  
			                </f:facet> 
						</p:cellEditor>
					</p:column>
					
					<p:column headerText="Candidate Location">
						<p:cellEditor>							
							<f:facet name="output">  
			                    <h:outputText value="#{row.candidateCurrentLocation}" />
			                </f:facet>  
			                <f:facet name="input">  
			                    <p:inputText  value="#{row.candidateCurrentLocation}" style="width:90px"/>  
			                </f:facet> 
						</p:cellEditor>
					</p:column>
					
					<p:column headerText="Total Exp">
						<p:cellEditor>							
							<f:facet name="output">  
			                    <h:outputText value="#{row.candidateExperience}" />
			                </f:facet>  
			                <f:facet name="input">  
			                    <p:inputText  value="#{row.candidateExperience}" style="width:45px"/>  
			                </f:facet> 
						</p:cellEditor>
					</p:column>
					
					<p:column headerText="CTC(INR)">
						<p:cellEditor>							
							<f:facet name="output">  
			                    <h:outputText value="#{row.ctc}" />
			                </f:facet>  
			                <f:facet name="input">  
			                    <p:inputText  value="#{row.ctc}" style="width:45px"/>  
			                </f:facet> 
						</p:cellEditor>
					</p:column>
					
					<p:column headerText="ECTC(INR)">
						<p:cellEditor>							
							<f:facet name="output">  
			                    <h:outputText value="#{row.ectc}" />
			                </f:facet>  
			                <f:facet name="input">  
			                    <p:inputText  value="#{row.ectc}" style="width:45px"/>  
			                </f:facet> 
						</p:cellEditor>
					</p:column>
					
					<p:column headerText="Notice Period Buyout">
						<p:cellEditor>							
							<f:facet name="output">  
			                    <h:outputText value="#{row.noticePeriodBuyOut}" />
			                </f:facet>  
			                <f:facet name="input">  
				                <p:selectOneMenu value="#{row.noticePeriodBuyOut}" style="width:80px">
									<f:selectItems value="#{uploadResourcesBean.noticePeriodBuyOutMap}" />
				   				</p:selectOneMenu>
			                </f:facet> 
						</p:cellEditor>
					</p:column>
					
					<p:column headerText="Buyout Cost">
						<p:cellEditor>							
							<f:facet name="output">  
			                    <h:outputText value="#{row.noticePeriodBuyOutCost}" />
			                </f:facet>  
			                <f:facet name="input">  
			                    <p:inputText  value="#{row.noticePeriodBuyOutCost}" style="width:80px" maxlength="5"/>  
			                </f:facet> 
						</p:cellEditor>
					</p:column>
					
					<p:column headerText="Expected Joining Date">
						<p:cellEditor>							
							<f:facet name="output">  
			                    <h:outputText value="#{row.expectedJoiningDate}" >
			                    	<f:convertDateTime pattern="dd-MMM-yyyy" timeZone="#{uploadResourcesBean.timeZone}"/>
			                    </h:outputText>
			                </f:facet>  
			                <f:facet name="input">  
			                    <p:calendar value="#{row.expectedJoiningDate}" style="width:50px;" pattern="dd-MMM-yyyy"/>  
			                </f:facet> 
						</p:cellEditor>
					</p:column>
					
					<p:column headerText="Source">
						<p:cellEditor>							
							<f:facet name="output">  
			                    <h:outputText value="#{row.recruitmentVendor.vendorName}" />
			                </f:facet>  
			                <f:facet name="input">  
			                   <p:selectOneMenu value="#{row.recruitmentVendor.recruitmentVendorId}" style="width:100px">
									<f:selectItems value="#{uploadResourcesBean.recruitmentVendorsMap}" />
			  				   </p:selectOneMenu>  
			                </f:facet> 
						</p:cellEditor>
					</p:column>
					
					<p:column headerText="Remarks">
						<p:cellEditor>							
							<f:facet name="output">  
			                    <h:outputText value="#{row.remarks}" />
			                </f:facet>  
			                <f:facet name="input">  
			                    <p:inputTextarea  value="#{row.remarks}" style="width:100px"/>  
			                </f:facet> 
						</p:cellEditor>
					</p:column>
					
					<p:column headerText="Edit" style="width:50px">  
			            <p:rowEditor />  
			        </p:column>  
					<p:column headerText="Operation" style="text-align: center; width: 30px;">		
						<p:commandButton icon="ui-icon-close" title="Remove from list"
							actionListener="#{uploadResourcesBean.removeRecruitmentResource}"
							update="@form" style="padding: 0"/>	
					</p:column>
					
		     </p:dataTable>
		   </p:scrollPanel>
		 </h:panelGrid>
		</p:panel>
				
		<h:panelGroup style="float:right;">
			<p:commandButton value="Upload Resources"  action="#{uploadResourcesBean.uploadResourcesAction}" update="@form"/>
			    <p:commandButton value="Back" onclick="history.back();"  />
		</h:panelGroup>
 </h:panelGrid>
 
  <p:dialog hideEffect="fade" showEffect="fade"
				header="Recommendation for  #{uploadResourcesBean.viewRecruitmentProfile.candidateName} "
				id="viewFeedbackDialog" widgetVar="viewFeedbackDialog" resizable="false"
				modal="true">
					
			<p:scrollPanel style="width:600px;height:500px" mode="native"> 
        	 <h:panelGrid columns="3"  cellspacing="7" style="width: 100%" columnClasses="employeeDetailLabel,gridCellMiddleLeftAligned">  
          
	           <h:outputLabel value="RRF Code" />
	           <h:outputLabel value=":" />
	           <h:outputText value="#{uploadResourcesBean.viewRecruitmentProfile.recruitmentRequestCode}"  />
	          
	           <h:outputLabel value="Technology" />
	           <h:outputLabel value=":" />
	           <h:outputText value="#{uploadResourcesBean.viewRecruitmentProfile.technology}"   />
	           
	           <h:outputLabel value="Candidate Name" />
	           <h:outputLabel value=":" />
	           <h:outputText value="#{uploadResourcesBean.viewRecruitmentProfile.candidateName}" />
	          
	           <h:outputLabel value="Candidate Email" />
	           <h:outputLabel value=":" />
	           <h:outputText value="#{uploadResourcesBean.viewRecruitmentProfile.candidateEmail}" />
	           
	           <h:outputLabel value="Candidate Contact" />
	           <h:outputLabel value=":" />
	           <h:outputText value="#{uploadResourcesBean.viewRecruitmentProfile.candidateMobileNumber}"/>
           
      	   </h:panelGrid>
          
       <p:panel header="Skill Ratings on a scale(1-10)">       
       <h:panelGrid  columns="2" style="width: 100%">             
           <p:dataTable value="#{uploadResourcesBean.skillRatingsSingleLevel}" var="viewSkills">
	
				<p:column headerText="Skill Area">
						<h:outputText value="#{viewSkills.rrfSelectedSkill.skillName}" />
				</p:column>
				<p:column headerText=" Interviewer1 Rating" >
						<h:outputText value="#{viewSkills.skillRating}" />				
				</p:column>
				<p:column headerText="Interviewer1 Remarks">
						<h:outputText value="#{viewSkills.skillRemarks}" />
				</p:column>				
		   </p:dataTable> 
		   <p:dataTable value="#{uploadResourcesBean.skillRatingsTwoLevel}" var="twoLevelSkills" rendered="#{uploadResourcesBean.recruitmentRequest.interviewLevel  eq 'Two Level' }">	
				
				<p:column headerText=" Interviewer2 Rating" >
						<h:outputText value="#{twoLevelSkills.skillRating}" />				
				</p:column>
				<p:column headerText="Interviewer2 Remarks" >
						<h:outputText value="#{twoLevelSkills.skillRemarks}" />
				</p:column>
					
		   </p:dataTable>
        </h:panelGrid>
      </p:panel>
         
       
       <p:panel header="Interviewer Views">   
       <h:panelGrid  columns="2" style="width: 100%"> 
         <h:panelGrid  cellspacing="7" style="width: 100%" columns="3" columnClasses="employeeDetailLabel,gridCellMiddleLeftAligned">
          
           <h:outputLabel value="Expected Joining Date" />
           <h:outputLabel value=":" />
           <h:outputText value="#{uploadResourcesBean.viewRecruitmentProfile.expectedJoiningDate}" >
         	  <f:convertDateTime pattern="dd-MMM-yyyy" timeZone="#{uploadResourcesBean.timeZone}" />
           </h:outputText>
           
           <h:outputLabel value="Strengths" />
           <h:outputLabel value=":" />
           <h:outputText value="#{uploadResourcesBean.viewRecruitmentProfile.intwr1Strengths}"   />
           
           <h:outputLabel value="Areas Of Improvement" />
           <h:outputLabel value=":" />
           <h:outputText value="#{uploadResourcesBean.viewRecruitmentProfile.intwr1AreaOfImprovement}"  />
           
           <h:outputLabel value="Remarks / Overall Impression" />
           <h:outputLabel value=":" />
           <h:outputText value="#{uploadResourcesBean.viewRecruitmentProfile.intwr1FinalRemarks}"   />
           
           <h:outputLabel value="Final Recommendation " />
           <h:outputLabel value=":" />
           <h:outputText value="#{uploadResourcesBean.viewRecruitmentProfile.intwr1FinalRecommendation}"   /> 
           
        </h:panelGrid>
        
        <h:panelGrid  cellspacing="7" columns="1" rendered="#{uploadResourcesBean.recruitmentRequest.interviewLevel  eq 'Two Level' }">  
          
           <h:outputText value="#{uploadResourcesBean.recruitmentProfile.expectedJoiningDate}" >
         	  <f:convertDateTime pattern="dd-MMM-yyyy" timeZone="#{uploadResourcesBean.timeZone}"/>
           </h:outputText>           
          
           <h:outputText value="#{uploadResourcesBean.viewRecruitmentProfile.intwr2Strengths}"   />           
      
           <h:outputText value="#{uploadResourcesBean.viewRecruitmentProfile.intwr2AreaOfImprovement}"  />
                     
           <h:outputText value="#{uploadResourcesBean.viewRecruitmentProfile.intwr2FinalRemarks}"   />           
        
           <h:outputText value="#{uploadResourcesBean.viewRecruitmentProfile.intwr2FinalRecommendation}"   /> 
           
        </h:panelGrid>
        
        </h:panelGrid>
     </p:panel>
     
     <!-- VIEW MANAGER RECOMMENDATIONS -->
	    <p:panel header="Manager Recommendation for :  #{uploadResourcesBean.viewRecruitmentProfile.candidateName}" > 
	    <h:panelGrid cellspacing="7" style="width: 100%" columns="3" columnClasses="employeeDetailLabel,gridCellMiddleLeftAligned">
		           
			           <h:outputLabel value="CTC(LPA)" />
			           <h:outputLabel value=":" />
			           <h:outputLabel value="#{uploadResourcesBean.viewRecruitmentProfile.ctc}"  />
			          
			           <h:outputLabel value="ECTC(LPA) " />
			           <h:outputLabel value=":" />
			           <h:outputLabel value="#{uploadResourcesBean.viewRecruitmentProfile.ectc}"  />
			           
			           <h:outputLabel value="% of Hike Expected " />
			           <h:outputLabel value=":" />
			           <h:outputLabel value="#{uploadResourcesBean.rrfManagerRecommendation.percentHikeExpected}"  />
			          
			           <h:outputLabel value="ERPandERP Offer(LPA)" />
			           <h:outputLabel value=":" />
			           <h:outputLabel value="#{uploadResourcesBean.rrfManagerRecommendation.erpOfferPriceLPA}" />
			       			
			           
			           <h:outputLabel value="% of Hike Offered(ERP)" />
			           <h:outputLabel value=":" />
			           <h:outputLabel value="#{uploadResourcesBean.rrfManagerRecommendation.erpOfferedHikePercent}"/>
			           
			           <h:outputLabel value="Band" />
			           <h:outputLabel value=":" />
			           <h:outputLabel value="#{uploadResourcesBean.viewRecruitmentProfile.band.band}" />
			          
			           <h:outputLabel value="Notice Period" />
			           <h:outputLabel value=":" />
			           <h:outputLabel value="#{uploadResourcesBean.viewRecruitmentProfile.candidateNoticePeriod}" />
			           
			           <h:outputLabel value="Proceed With Notice Period BuyOut" />
			           <h:outputLabel value=":" />
			           <h:outputLabel value="#{uploadResourcesBean.rrfManagerRecommendation.processNoticePeriodBuyOut}" />
						
			           <h:outputLabel value="Notice Period Buyout" />
			           <h:outputLabel value=":" />
			           <h:outputLabel value="#{uploadResourcesBean.viewRecruitmentProfile.noticePeriodBuyOut}" />
			           
			           <h:outputLabel value="Notice Period Buyout Cost" />
			           <h:outputLabel value=":" />
			           <h:outputLabel value="#{uploadResourcesBean.viewRecruitmentProfile.noticePeriodBuyOutCost}" />
			           
			          <h:outputLabel value="Notice Period BuyOut Remarks" />
			           <h:outputLabel value=":" />
			           <h:outputLabel value="#{uploadResourcesBean.rrfManagerRecommendation.noticePeriodBuyOutRemarks}" />
			          			          			           
			           <h:outputLabel value="Manager Remarks" />
			           <h:outputLabel value=":" />
			           <h:outputLabel value="#{uploadResourcesBean.rrfManagerRecommendation.managerRemarks}" />
			           
			           <h:outputLabel value=" Manager Final Recommendation" />
			           <h:outputLabel value=":" />
			           <h:outputLabel value="#{uploadResourcesBean.rrfManagerRecommendation.managerRecommendation}" />			           		
			           
				</h:panelGrid>
				</p:panel>
			</p:scrollPanel>	
			
			<h:panelGroup style="float:right;">
				<p:commandButton id="submitButton" value="Close" actionListener="#{uploadResourcesBean.dialogCloseListener}"/>
			</h:panelGroup>	
					
					
			</p:dialog>
				
 
     </h:form>
	</ui:define>
</ui:composition>
